
$(function () {
    var oWebControl;
    var fontSize = $$.fitFontSize(16);
    var plynDatas; //行政区划
    var plyn, marker;
    var mapPlyns=[],mouseLnglat;//地图区块数组
    // var mapAreaCode = '330000'; //区划关键点

    var urlAreaCode = $$.localName('areaCode');
    var urlAreaName = $$.localName('areaText');
    var mapAreaCode = urlAreaCode ? urlAreaCode :'330000'; //区划关键点

    var commonYear = (new Date()).getFullYear();
    var isMapScale = false;
    var isMapClick = false;
    var mapLastZoom;
    var zcyjgList;//获取仲裁机构字典
    var cxfwList;// 获取查询范围字典
    var scrollckTimer=null;
    var scrollTimer=null;
    var fh_btn=false;//tab点击切换
    $('[page-href]').click(function(){
        var src = $(this).attr('page-href');
        window.parent.changeMainPage(src);
    })
    //地图指标类型
    var mapTypes = {
        main:[
            {name:'在办案件',value:'zbajs'},
            // {name:'仲裁按期结案率',value:'zcaqjal'},
            // {name:'网络办案率',value:'wlbal'},
            // {name:'调解结案率',value:'tjcgl'}
        ],
      
    };
    var mapLevelSelects = {
        main_zbajs: [
            { lt: 90, class: 'green' },
            { lt: 189, gt: 90, class: 'yellow' },
            { gt: 200, class: 'red' },
            
        ],
        // main_ssjsjccs: [
        //     { gt: 100, class: 'green' },
        //     { lt: 100, gt: 10, class: 'yellow' },
        //     { lt: 10, class: 'red' },
        // ],
    }
  
    var mapColor = {
        normal: 'rgba(56,108,161,0.60)',
        active:'rgba(89,147,212,1)'
    }
    $(".model_tab span").on('click',function(){
        $(this).addClass('active').siblings().removeClass('active');
        var type= $(this).attr('data-type');
        
    })
    //所属管辖
    var areaDatas = [
        { label:'浙江省',value:'330000'},
        { label:'杭州市',value:'330100'},
        { label:'宁波市',value:'330200'},
        { label:'温州市',value:'330300'},
        { label:'嘉兴市',value:'330400'},
        { label:'湖州市',value:'330500'},
        { label:'绍兴市',value:'330600'},
        { label:'金华市',value:'330700'},
        { label:'衢州市',value:'330800'},
        { label:'舟山市',value:'330900'},
        { label:'台州市',value:'331000'},
        { label:'丽水市',value:'331100'},
        
    ],areaSelects=[];
    var sjgjPageTimer = null;

    // 顶部区划
    if(urlAreaCode){
        $(".map_tit span").attr('data-i',urlAreaCode);
        $(".map_tit span").text(urlAreaName);
    } 

    var myGDMap = new AMap.Map('map', {
        resizeEnable: true,
        rotateEnable: true,
        pitchEnable: true,
        zoom: 8,
        pitch: 45,
        // mapStyle: "amap://styles/dark",
        // mapStyle:'amap://styles/1c4fb1696d4e7344252ebc6334365e0c',
        mapStyle:'amap://styles/2b4440833495a1a629cd5595fec460c2',
        rotation: 0,
        // viewMode:'3D',//开启3D视图,默认为关闭
        buildingAnimation: true, //楼块出现是否带动画
        expandZoomRange: true,
        center: areaCenter[$$.handleQXCode(mapAreaCode)].center,
        zooms: areaCenter[$$.handleQXCode(mapAreaCode)].zooms,

    });
    var mapActiveAreaData = {};
    // AMap.plugin([
    //     'AMap.ToolBar',
    // ], function () {
    //     // 在图面添加工具条控件，工具条控件集成了缩放、平移、定位等功能按钮在内的组合控件
    //     myGDMap.addControl(new AMap.ToolBar({
    //         // 简易缩放模式，默认为 false
    //         liteStyle: false
    //     }));
    // });
    $(document).mousemove(function(e){//获取鼠标位置，转成经纬度（区域放大下钻）
        e = e || window.event;
        // 容器坐标，原点为左上角
        var px = e.pageX;
        var py = e.pageY;
        // 构造成 Pixel 对象后传入
        mouseLnglat = myGDMap.containerToLngLat(new AMap.Pixel(px, py)); 
    })
   
   
    $('.map_tit .loc').live('click',function(){// 下钻记录点击
        mapAreaCode = $(this).attr('data-i');
        var mapLevel = getAreaLevel(mapAreaCode);
        $(this).nextAll().remove();
        $(this).addClass('active');
        if(mapLevel == 0){
            myGDMap.setZoomAndCenter(8, [120.153576,29.289523]);
            setModelMain()
        }else if(mapLevel == 1){
            myGDMap.setZoomAndCenter(9, [mapActiveAreaData.x,mapActiveAreaData.y]);
            setModelMain();
        }else if(mapLevel == 2){
            setModelMain()
        }
    })
    $('.backToOriginal').click(function () {//地图 回归定位点
        mapAreaCode = mapAreaCode;
        myGDMap.setZoomAndCenter(8, areaCenter[$$.handleQXCode(mapAreaCode)].center);
        $('.map_tit .loc').eq(0).nextAll().remove();
        setModelMain();
    })
  
    //地图 放大
    $('.add').click(function () {
        var zoom = myGDMap.getZoom();
        if (zoom < 20) {
            myGDMap.zoomIn();
        }
    })
    //地图 缩小
    $('.del').click(function () {
        var zoom = myGDMap.getZoom();
        if (zoom > 7) {
            myGDMap.zoomOut();
        }
        
    })
    layui.use(['form','laydate'], function(){
        var laydate = layui.laydate;
        //年选择器
        laydate.render({ 
            elem: '#year',
            type: 'year',
            value: (new Date()).getFullYear(),
            min: -366,
            max: 0,
            done: function (value,date) {
                commonYear = value;
                setModelMain()
            },
            // change: function(value, date){ //监听日期被切换
            //     commonYear = value;
            //     setModelMain()
            // }
        });
    });
    $('.block_name').live('click',function () {
        var childModelClick = $(this).attr('data-model');
        if(childModelClick){
            $('.tablist .tab_item.active').attr('child-model-click',childModelClick);
           
        }else{
            $('.tablist .tab_item.active').attr('child-model-click','');
        }
    })

   
    getcxfwList()// 获取查询范围字典 设置为同步方法
    getzcyjgList()// 获取仲裁机构字典 设置为同步方法
    function getzcyjgList(){
       $$.ajaxRequest( ajaxUrl2 + "/lemis/business/dp/tsInterface",
           {
             method: "queryTheDictionary",
             source: 3,
             dType: 1,
           },
           function (res) {
               console.log(res.data,"datat")
               if(res.data && res.data.length>0){
                   zcyjgList = [{
                       id: "1",
                       title: "浙江省劳动人事争议仲裁院",
                       child: getChildren('1',res.data)
                   }]
               }

           }
         );
    }
    function getChildren(areacode,data){
       var child = [];
       $.each(data,function(i,item){
           if(item.pid == areacode){
               child.push({
                   id: item.id,
                   pid: item.pid||'',
                   title: item.name,
                   child: getChildren(item.id,data)
               });
           }
       })
       return child;
   }
  
  function getcxfwList(){
    // 获取查询范围字典 设置为同步方法
    $$.ajaxRequest(
      ajaxUrl2 + "/lemis/business/dp/tsInterface",
      {
        method: "queryTheDictionary",
        source: 3,
        dType: 2,
        aaa100: "CXFW",
      },
      function (res) {
         cxfwList = (res.data||[]).map(item =>{
            return{
              label:item.aaa103,
              value:item.aaa102,
            }
        });
      }
    );
   }
    function getChData(url, type, callback){
        $$.ajaxRequest(ajaxUrl2 + url, type, function (res) {
            if(typeof callback == 'function'){
                callback(res);
            }
        })
    }
     
    //初始化
    setModelMain()
    function setModelMain(notRenderMap){//TODO: 首页
        setMapTypeSelects()
        if(!notRenderMap){
            initMap();//初始化地图调用
            
        }

        //案件办理情况
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondaryZero',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear
        },function(res){
            console.log('ajblqk',res);
            setZBData('.ajblqk', res.data,function(){
                $(".ajblqk [data-key]").off("click").click(function(){
                      var obj=$(this).attr("data-key");
                      // ajdjnum
                      if(obj=="djs"){
                        alertZBAYZBtable("立案数")
                      }else if(obj=="blz"){
                        alertZBAYZBtable("办理中",{isblz:1})
                      }else if(obj=="bjs"){
                        alertZBAYZBtable("结案数",{isbjs:1})
                      }
                })
            })
        });

        // 案件趋势
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondaryOne',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear,
            dType: 1
        },function(res){
            setLine('#ajqs',{
                unit:'件',
                "categories":res.data.map(item=>item.name),
                "series":[
                    {"name":"数量","data":res.data}
                ]
            },{color:["#34C39D"],hideArea:true},function(params){
                alertZBAYZBtable(params.name,{month:params.key})
            })
        });
        // 案件来源
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondaryTwo',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear
        },function(res){
            // normalPie('#ajpie', { datas: res.data}, {},function(params){
            //     alertZBAYZBtable(params.name,{ajly:params.aaa102})
            // })

            setPie('#ajpie', {
                datas: res.data, unit: "件"
            }, {
                showValue: true,
                showPercent: false,
                nameWidth: $$.fitFontSize(180),
                legendLeft: "40%",
                radius: ['45%', '72%'],
                radius2: ["45%", "48%"]
            }, function (params) {
                var index = res.data.map(item=>item.name).indexOf(params.name)
                alertZBAYZBtable(params.name,{ajly:params.aaa102})
                // alertZBAYZBtable(params.name,{ajlx:res.data[index].key})
            })
        });
        // 处理结果
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondaryThree',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear
        },function(res){
            moreBar("#moreBar",{datas:res.data,unit:'件'},{
            },function(params){
                var index = res.data.map(item=>item.name).indexOf(params.name)
                alertZBAYZBtable(params.name,{scczjg:res.data[index].key})
            })
        });

        //浙江省
        getMapNum('zbajs')
        // getChData('/lemis/business/dp/tsInterface', {
        //     method:'arbitrationReviewSecondaryFour',
        //     source:3,
        //     administrativeDivisionCode:mapAreaCode,
        //     year:commonYear,
        //     dType: 1 //1为在办案件、2仲裁按期结案率、3网络办案率、4调解成功率。
        // },function(res){
        //     setZBData('.model0', res.data)
        // });

        //最新案件
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondarySix',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear
        },function(res){
            // console.log('6',res)
            gettablePhb({
                tableId:"#tableId",
                autoScroll:true,
                time:2500,
                tableClickType:2,
                imgIndex:false,
                scrollName:scrollckTimer,
                columns:[
                    {title:"时间",field:"abb017"},
                    {title:"案件名称",field:"abb016"},
                    {title:"仲裁员",field:"pop1_1"}
                ],
                data:res.data.list
            })
        });
        // 案件类型
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondarySeven',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear
        },function(res){
            setPie('#ajlxpie', {
                datas: res.data, unit: "件"
            }, {
                showValue: true,
                showPercent: false,
                nameWidth: $$.fitFontSize(160),
                legendLeft: "40%",
                radius: ['55%', '82%'],
                radius2: ["55%", "58%"]
            }, function (params) {
                var index = res.data.map(item=>item.name).indexOf(params.name)
                alertZBAYZBtable(params.name,{ajlx:res.data[index].key})
            })
        });
    }
    //履行情况
    getChData('/lemis/business/dp/tsInterface', { //死数据
        method:'arbitrationReviewSecondaryEight',
        source:3,
        administrativeDivisionCode:330000,
        year:2021
    },function(res){
        var liquidFill = $('.liquidFill');
        $.each(res.data,function(i,item){
            $('.liquidFill'+(i+1)).find(".name").html(item.name||"")
            sqt(liquidFill[i],{value:item.value,key:item.key},"件",function(params){
                alertZBAYZBtable("案件",{lxqk:params})
            });
        })
        // sqt("#liquidFill",50,"件")
        // sqt("#liquidFill1",50,"件")
        // sqt("#liquidFill2",50,"件")
    });

    //送达情况
    getChData('/lemis/business/dp/tsInterface', { //死数据
        method:'arbitrationReviewSecondaryNine',
        source:3,
        administrativeDivisionCode:330000,
        year:2021
    },function(res){
        var color = [
            {color1:'#40D0FD',color2:'#00FFF6'},
            {color1:'#35C489',color2:'#0BC9C7'},
            {color1:'#FFB266',color2:'#EAD41B'}
        ]
        $.each(res.data,function(i,item){
            PercentCircle(`#sdqk${i+1}`, {
                "value": item.value,
                key:item.key||"",
                unit:"%",
            },{radius:['70%', '90%'],colors:color[i]},function(params){
                alertZBAYZBtable("案件",{sdqk:params})
            })
        })
        // PercentCircle("#sdqk1", {
        //     "value": 90,
        //      unit:"%",
        // },{radius:['70%', '90%'],colors:{color1:'#40D0FD',color2:'#00FFF6'}})
        // PercentCircle("#sdqk2", {
        //     "value": 90,
        //      unit:"%",
        // },{radius:['70%', '90%'],colors:{color1:'#35C489',color2:'#0BC9C7'}})
        // PercentCircle("#sdqk3", {
        //     "value": 90,
        //      unit:"%",
        // },{radius:['70%', '90%'],colors:{color1:'#FFB266',color2:'#EAD41B'}})
    });


    // 最新案件更多
    $('#zxanj_more').on('click',function(){
        alertZXAJtable("最新案件")
    })

    function getMapNum(type){
        type == 'zbajs' ? type = 1 : (type == 'zcaqjal' ? type = 2 : (type == 'wlbal' ? type = 3 : type =4))
        getChData('/lemis/business/dp/tsInterface', {
            method:'arbitrationReviewSecondaryFour',
            source:3,
            administrativeDivisionCode:mapAreaCode,
            year:commonYear,
            dType: type //1为在办案件、2仲裁按期结案率、3网络办案率、4调解成功率。
        },function(res){
            setZBData('.model0', res.data,function(){
                $(".axzs_box").off("click").click(function(){
                    alertZBAYZBtable("案件",{zbaj:1})
                })
            })
            // $('.ajblqk [data-key="jal"]').html(res.data.jal);
        });
    }

    function sqt(id,data,unit,clickFun){
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var value = 0.44;
        let option = {
            // backgroundColor: '#181b22',
            title: [
                {
                    text: data.value+ unit,
                    left: '50%',
                    top: '40%',
                    textAlign: 'center',
                    textStyle: {
                        fontSize: $$.fitFontSize(22),
                        fontWeight: '400',
                        color: '#fff',
                        textAlign: 'center',
                        textBorderColor: 'rgba(0, 0, 0, 0)',
                        textShadowColor: '#000',
                        textShadowBlur: '0',
                        textShadowOffsetX: 0,
                        textShadowOffsetY: 1,
                    },
                },
            ],
            polar: {
                radius: ['63%', '60%'],
                center: ['50%', '50%'],
            },
            angleAxis: {
                max: 100,
                clockwise: false,
                axisLine: {
                    show: false,
                },
                axisTick: {
                    show: false,
                },
                axisLabel: {
                    show: false,
                },
                splitLine: {
                    show: false,
                },
            },
            radiusAxis: {
                type: 'category',
                show: true,
                axisLabel: {
                    show: false,
                },
                axisLine: {
                    show: false,
                },
                axisTick: {
                    show: false,
                },
            },
            series: [
                {
                    type: 'liquidFill',
                    radius: '60%',
                    z: 1,
                    center: ['50%', '50%'],
                    amplitude: 20,
                    color: "#06BB70",
                    data: [
                        0.3,
                        {
                            value: 0.2,
                            direction: 'left',
                        },
                    ],
                    backgroundStyle: {
                        borderWidth: 1,
                        color: 'transparent',
                    },
                    label: {
                        normal: {
                            formatter: '',
                        },
                    },
                    outline: {
                        show: true,
                        itemStyle: {
                            borderWidth: 0,
                        },
                        borderDistance: 0,
                    },
                },
                {
                    name: '',
                    type: 'bar',
                    roundCap: true,
                    z: 2,
                    showBackground: true,
                    backgroundStyle: {
                        color: '#15181e',
                    },
                    data: [100],
                    coordinateSystem: 'polar',
                    itemStyle: {
                        normal: {
                            color: new echarts.graphic.LinearGradient(0, 0, .5, 1, [
                                {
                                    offset: 0,
                                    color: '#5acef2',
                                },
                                {
                                    offset: .7,
                                    color: '#5073fb',
                                },
                                {
                                    offset: 1,
                                    color: '#6ae8d8',
                                },
                            ]),
                        },
                    },
                },
            ],
        };
        myChart.setOption(option, true);
        myChart.off("click");
        myChart.on("click", function (params) {
        clickFun && clickFun(data.key);
      
    });
    }
    function gettablePhb(config) {
        var id = config.tableId || ''
        var columns = config.columns || []
        var datas = config.data || [];
        var scrollName = config.scrollName;
        var html = '<div class="tbodyBox"><div class="tbody">';
        var head_html_ = `<div class="thead"><div class="t_tr">`
        $.each(columns, function (i, item) {
            head_html_ += '<div class="text_overflow" style="width:' + (item.width || 'calc(100% / ' + columns.length + ')') + '" title="' + item.title + '">' + (item.title) + '</div>'
        })
        head_html_ += ` </div></div>`
        $.each(datas, function (i, item) {
            html += ` <div class="t_tr tr" data-i="${i}">`
            $.each(columns, function (j, jItem) {
                if (jItem.type == 'index') {
                    if (config.imgIndex) {
                        html += `<div style="width:${jItem.width ? jItem.width : 'calc(100% /' + columns.length + ')'}">
                        <i class="pm pm_box pm_${i + 1}"><span>top${i > 9 ? i + 1 : '0' + (i + 1)}</span></i></div>`
                    } else {
                        html += `<div style="width:${jItem.width ? jItem.width : 'calc(100% /' + columns.length + ')'}">
                        <i class=" pm_box "><span>${i + 1}</span></i></div>`
                    }

                } else {
                    html += `<div style="width:${jItem.width ? jItem.width : 'calc(100% /' + columns.length + ')'}"  title="${(item[jItem.field] || '')}${jItem.unit ? jItem.unit : ''}" >
                        ${(item[jItem.field] || '')}${jItem.unit ? jItem.unit : ''}</div>`
                }
            })
            html += `</div>`
        });
        html += `</div></div>`
        if (datas.length > 0) {
            $(id).html(head_html_ + html);
        } else {
            $(id).html(head_html_ + `<div style=" text-align: center;">暂无数据</div>`);
        }
        $(id+" .tr").on("click",function(){
            var index=$(this).attr("data-i")
            var id=datas[index].abz301||''
            if(config.tableClickType==2){
                alertZBAJDetails(id);
            }else if(config.tableClickType==true){
                config.funClick&&config.funClick(datas[index])
            }
            
        })
        if (config.autoScroll&&datas.length>3) {
            console.log(config.time, "config.time",)
            clearInterval(scrollName)
            scrollName = $(id + ' .tbody').scrollTable2({
                interval: config.time,
                scrollByRow: true,
            })
        }
    }
    
    function alertZBAYZBtable(title,params,abb017Start,abb017End,abz345,cxfw){
        params= params||{}
        if(!params.administrativeDivisionCode){
          params.administrativeDivisionCode=mapAreaCode
        }
       var where={
             mType: 3,
             year:commonYear,
             abz345: abz345 || '',
             cxfw: cxfw || '',
             abb017Start:abb017Start || '',
             abb017End:abb017End || ''
            
           }
       $$.alertTable({
           title: title,
           colsData: [
             [
                { title: "序号", type: "numbers" },
               { title: "案号", field: "abb016" },
               { title: "申请人", field: "abb703" },
               { title: "被申请人", field: "abb704" },
               { title: "仲裁员(申请接待员)", field: "pop1_1"},
             ],
           ],
           url: ajaxUrl2 + "/lemis/business/dp/tsInterface?method=caseList&source=3",
           where: Object.assign(params,where),
           pageProp: {
             limit: 10,
           },
           searchColumn: [
            {
                name: "所属仲裁机构",
                field: "abz345",
                type:'dropdown',
                dicData: zcyjgList,
              },
             {
               name: "查询范围",
               field: "cxfw",
               type: "select",
               dicData: cxfwList,
             },
             { name: "立案时间起", field: "abb017Start", type: "datePicker", range: false, subtype: "date", format: "yyyy年MM月dd日" },
             { name: "立案时间至", field: "abb017End", type: "datePicker", range: false, subtype: "date", format: "yyyy年MM月dd日" },
           ],
           rowClickFun: function (obj) {
               let data = obj.data.abz301;
               alertZBAJDetails(data);
           },
         });
    }


    function alertZBAJDetails(data) {
    var tableColumns = [
        [
        { title: "案号", field: "abb016" },
        { title: "被申请人", field: "abb704" },
        { title: "申请人", field: "abb703" },
        { title: "申请类型", field: "bbb705name" },
        { title: "案件来源", field: "ajly" },
        { title: "仲裁员", field: "abb782name" },
        { title: "书记员", field: "abb785name" },
        { title: "立案日期", field: "abb017" },
        { title: "案件进行天数", field: "day1" },
        ],
        [
        { title: "仲裁请求", field: "abb878" },
        { title: "仲裁事实和理由", field: "abb712" },
        ],
    ];
    var ecm = $$.alert("axzs");
    $("#" + ecm).html(`     
                <div class="title aj">案件详情</div>         
                <div class="table_con ajxq">         
                    <div class="model">         
                        <div class="detail_title">基本信息&nbsp;&nbsp;</div>        
                        <div class="model_content ztxxTable"></div>    
                    </div>
                    <div class="model">        
                        <div class="detail_title long_bg">&nbsp;&nbsp;&nbsp;&nbsp;劳动者（申请人）</div>         
                        <div class="news ztxxTable1"></div>        
                    </div>

                    <div class="model">         
                        <div class="detail_title long_bg">&nbsp;&nbsp;&nbsp;用人单位（被申请人）</div>       
                        <div class="news ztxxTable2"></div>     
                    </div>

                    
                    
                    <div class="model">         
                        <div class="detail_title">申请信息&nbsp;&nbsp;</div>       
                        <div class="model_content ztxxTable3"></div>     
                    </div>

                    <div class="model">         
                        <div class="detail_title long_bg">&nbsp;&nbsp;&nbsp;办事记录
                        </div>       
                        <div class="news bsjl ztxxTable5"></div>     
                    </div>
                </div>
            `);

    $$.ajaxRequest(
        ajaxUrl2 + "/lemis/business/admin/queryHitoricInfo",
        {
            abz301: data,
            type:1,
            source: 3,
        },
        function (res) {
        var list = res.root;
        // 数据处理
        var blackList = ["开始","结束","立案审批","结案审批"];
        list = list
        .filter((item) => item.activityName&&blackList.indexOf(item.activityName) == -1)
        .map((item) => {
            return {
                assign_name: item.assign_name.includes("red") ? item.assign_name.replaceAll("<span  style=\"color:red\">","") : item.assign_name,
                endTime: item.endTime,
                startTime: item.startTime,
                activityName: $$.handleActivityName(item.activityName),
            };
        });
        // 倒序
        list = list.reverse();

        gettablePhb({
            tableId: ".ztxxTable5",
            autoScroll: false,
            time: 2500,
            imgIndex: false,
            scrollName: scrollckTimer,
            columns: [
            { title: "序号", type: "index",width: "4%" },
            { title: "环节名称", field: "activityName",width: "24%" },
            { title: "办理人", field: "assign_name",width: "24%" },
            { title: "开始时间", field: "startTime",width: "24%" },
            { title: "结束时间", field: "endTime",width: "24%" }
            ],
            data: list,
        });
    })

    $$.ajaxRequest(
        ajaxUrl2 + "/lemis/business/dp/tsInterface",
        {
        abz301: data,
        method: "caseDetails",
        source: 3,
        },
        function (res) {
        var data = res.data || {};
        $$.title3Table("#" + ecm + " .ztxxTable", tableColumns[0], data.bybusorabz301 || {}, 3);

        gettablePhb({
            tableId: ".ztxxTable1",
            autoScroll: false,
            time: 2500,
            imgIndex: false,
            scrollName: scrollckTimer,
            columns: [
            { title: "序号", type: "index",width: "5%" },
            { title: "劳动者姓名", field: "aac003" },
            { title: "证件号码", field: "aac002" },
            { title: "性别", field: "aac004" },
            { title: "联系电话", field: "aae005" },
            { title: "通讯地址", field: "bae198" },
            ],
            data: [data.beyondcasedetailsbasic],
        });

        gettablePhb({
            tableId: ".ztxxTable2",
            autoScroll: false,
            time: 2500,
            imgIndex: false,
            scrollName: scrollckTimer,
            columns: [
            { title: "序号", type: "index",width: "5%" },
            { title: "单位名称", field: "aab004" },
            { title: "法定代表人", field: "aab013" },
            { title: "法定代表人职务", field: "aab502" },
            { title: "法定代表人联系电话", field: "aab015" },
            { title: "联系人", field: "aab503" },
            { title: "联系人联系电话", field: "aab505" },
            { title: "通讯地址", field: "bae198" },
            { title: "单位性质", field: "aab019" },
            ],
            data: [data.beyondcasedetailsrespondent],
        });

        $$.title3Table("#" + ecm + " .ztxxTable3", tableColumns[1], data.bybusorabz301 || {}, 1);
        // $$.title2Table("#" + ecm + " .ztxxTable2", tableColumns[0], data || {}, 2);

        // if(data.yja011-0 == 2){

        //     $$.title2Table('#'+ecm+' .jbqkTable', tableColumns[2], data||{},2);

        // }else{

        //     $('#'+ecm+' .czqk').hide();

        // }
        }
    );
    }



    function setBarOrLine(id, data, option,clickFun) {
       
        option = option || {};
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.series,
            series = [],
            unit = data.unit;
        var color = option.color || [
            {color2:'',color1:'#15C0FF'},
            {color2:'',color1:'#34C39D'},
            {color2:'',color1:'#FF6169'},
            {color2:'',color1:'#FFBD1E'},
        ];
        var chartType = '';
        datas.map((item, i) => {
            chartType = item.type||'line'
            series.push({
                animation: true ,
                name: item.name,
                stack: item.stack || '',
                type: item.type,
                data: item.data,
                barWidth: option.barWidth||10,
                // barMinHeight: (option.barWidth||10)/3,
                itemStyle: {
                    color: item.type=='line'?color[i].color1:new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: color[i].color1
                        },
                        {
                            offset: 1,
                            color: color[i].color2||color[i].color1
                        }
                    ])
                },
                yAxisIndex: item.yAxisIndex||0,
                symbol: 'circle',
                symbolSize: 4,
                smooth:true,
                lineStyle: {
                    width: 2,
                    color: color[i].color1,
                },
            })
        })
        var myOption = {
            grid: {
                left: 0,
                top:  $$.transVHFontSize(1.7+1.7),
                bottom: 0,
                right: 0,
                containLabel: true,
            },
            tooltip: {
                show: true,
                trigger: 'axis',
                confine:true
            },
            legend: {
                show: true,
                left:option.twoYAxis?'center':'right',
                top:0,
                itemWidth: $$.transVHFontSize(1.2),
                itemHeight: $$.transVHFontSize(.8),
                itemGap: $$.transVHFontSize(2),
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff',
                },
            },
            xAxis: [
                {
    
                    type: 'category',
                    axisLabel: {
                        interval:0,
                        formatter: '{value} ',
                        color: '#ffffff',
                        textStyle: {
                            fontSize: fontSize,
                        },
                        rotate: option.xAxisRotate||0
                    },
                    boundaryGap: true,
                    interval:0,
                    data: data.categories,
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show: option["yAxisSplitLineShow"] || false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
            ],
            yAxis: [
                {
                    type: 'value',
                    axisLabel: {
                        formatter: '{value} ',
                        color: '#ffffff',
                        textStyle: {
                            fontSize: fontSize,
                        },
                    },
                    name: unit[0] ? '单位：' + unit[0] : "",
                    nameGap: $$.transVHFontSize(1.2),
                    nameTextStyle: {
                        //   align: "right",
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLabel: {
                        show: true,
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show:  false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
                {
                    show: option.twoYAxis||false,
                    type: 'value',
                    axisLabel: {
                        formatter: '{value} ',
                        color: '#ffffff',
                        textStyle: {
                            fontSize: fontSize,
                        },
                    },
                    name: unit[1] ? '单位：' + unit[1] : "",
                    nameGap: $$.transVHFontSize(1.2),
                    nameTextStyle: {
                        //   align: "right",
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLabel: {
                        show: true,
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show:  false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
            ],
            series: series,
        };
        myChart.setOption(myOption, true)
        myChart.off('click');
        myChart.on("click",function(params){
            var index = datas.map(item=>item.name).indexOf(params.name);
            if(index>-1){
                params.chartData = datas[index];
            }
            clickFun&&clickFun(params)
        })
    }
    function normalPie(id, data, option, clickFun) {
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.datas;
        var maxNameLength = ((datas.map(item => {
            return item.name.length;
        })).sort(function (a, b) {
            return b - a;
        }))[0];
        var total = 0;
        datas.map(item => {
            total += item.value;
        })
        var unit = data.unit || ""
        var myOption = {
            series: [{
                name: '访问来源',
                type: 'pie',
                // minAngle: 10,
                startAngle:50, //起始角度
                radius: ['35%', '65%'],
                center: ['45%', '50%'],
                color: option.color || ['#2F9EFE', '#34C39D', '#FDAE5A', '#FF6169', '#8E67FF', '#89D47F'], //'#FBFE27','rgb(11,228,96)','#FE5050'
                data: datas,
                label: {
                    normal: {
                        formatter: ['{b|{b}}', '{c|{c}}{a|' + unit + '}'].join('\n'),
                        rich: {
                            c: {
                                color: '#2EECFD',
                                fontSize: $$.fitFontSize(20),
                                fontWeight: 'bold',
                                lineHeight: 5
                            },
                            b: {
                                color: '#fff',
                                fontSize: $$.fitFontSize(18),
                                height: 30
                            },
                            a: {
                                color: '#fff',
                            },
                        },
                    }
                },
                labelLine: {
                    normal: {
                        lineStyle: {
                            color: '#fff',
                        },
                        smooth: 0.2,
                        length: 10,
                        length2: 20,

                    }
                },
                itemStyle: {
                    normal: {
                        shadowColor: 'rgba(0, 0, 0, 0.8)',
                        shadowBlur: 50,
                    }
                }
            }]
        };
        myChart.setOption(myOption, true);
        myChart.off("click");
        myChart.on("click", function (params) {
        clickFun && clickFun(params.data);
      
    });
        // myChart.off("legendselectchanged");
        // myChart.on("legendselectchanged", function (params) {
        //     var isSelected = params.selected[params.name];
        //     var title = params.name
        //     if (isSelected == false) {
        //         myChart.dispatchAction({
        //             type: 'legendToggleSelect',
        //             name: params.name
        //         });
        //         myChart.dispatchAction({
        //             type: 'highlight ',
        //             name: params.name
        //         });
        //         clickFun && clickFun(params)
        //     }
        // });
    }

    function moreBar(id, data, option, clickFun) {
    var elem = $(id)[0];
    var myChart = echarts.init(elem);
    let color = ["#6d9de0", "#49d896", "#f5d03a", "#f5853a", "#f5503a"];
    var chartData = data.datas;
    var maxNameLength = chartData
      .map((item) => {
        return item.name.length;
      })
      .sort(function (a, b) {
        return b - a;
      })[0];
    var unit = data.unit || "";
    let arrName = [];
    let arrValue = [];
    let sum = 0;
    let pieSeries = [],
      lineYAxis = [];

    // 数据处理
    chartData.forEach((v, i) => {
      arrName.push(v.name);
      arrValue.push(v.value - 0);
      sum = sum + (v.value - 0);
    });
    if (sum == 0) {
      sum = 100;
    }
    // 图表option整理
    chartData.forEach((v, i) => {
      // console.log(v,i, v.value,sum - v.value)
      let chartnewData = chartData.slice(0, i);

      let newValue = chartnewData.reduce((a, b) => {
        return a + b.value;
      }, 0);
      // v.startAngle = newValue / sum * 360
      v.startAngle = newValue == 0 ? 360 : newValue * 360;
      console.log(v.startAngle,"v.startAngle",sum)
      pieSeries.push({
        name: "学历",
        type: "pie",
        clockWise: true,
        hoverAnimation: false,
        radius: [75 - i * 15 + "%", 68 - i * 15 + "%"],
        center: ["30%", "50%"],
        label: {
          show: false,
        },
        startAngle: v.startAngle>3222000?3222000+90:v.startAngle + 90,
        data: [
          {
            value: v.value - 0,
            name: v.name,
          },
          {
            value: sum - (v.value - 0),
            name: "",
            itemStyle: {
              color: "rgba(0,0,0,0)",
            }, 
          },
        ],
      });
      pieSeries.push({
        name: "",
        type: "pie",
        silent: true,
        z: 1.3,
        clockWise: true, //顺时加载
        hoverAnimation: false, //鼠标移入变大
        radius: [75 - i * 15 + "%", 68 - i * 15 + "%"],
        // radius: ['50%', '70%'],
        center: ["30%", "50%"],
        label: {
          show: false,
        },
        data: [
          {
            value: sum,
            itemStyle: {
              color: "rgba(16, 70, 99,.2)", //圆环颜色
            },
          },
          {
            value: 0,
            name: "",
            itemStyle: {
              color: "",
            },
          },
        ],
      });
    //   v.percent = ((v.value / sum) * 100).toFixed(0) + unit;
      lineYAxis.push({
        value: i,
        textStyle: {
          rich: {
            circle: {
              color: color[i],
              padding: [0, 5],
            },
          },
        },
      });
    });

    var myOption = {
      color: option.color || ["#2F9EFE", "#34C39D", "#FDAE5A", "#FF6169", "#8E67FF", "#89D47F"],
      legend: {
        itemWidth: $$.transVHFontSize(1.5),
        itemHeight: $$.transVHFontSize(1.1),
        show: true,
        top: option.legendTop || "middle",
        left: option.legendLeft || "50%",
        itemGap: option.legendItemGap || $$.transVHFontSize(0.25),
        formatter: (name) => {
          return (
            // {name|' + item.name + '}
            "{name|" +
            name +
            "} {value|" +
            chartData.find((item) => {
              return item.name == name;
            }).value +
            unit +
            "}"
          );
        },
        textStyle: {
          fontSize: fontSize,
          color: "#fff",
          rich: {
            name: {
              fontSize: fontSize,
              width: option.nameWidth || maxNameLength * $$.fitFontSize(18),
            },
            value: {
              fontSize: fontSize,
              color: "#fff",
            },
            percent: {},
          },
        },
      },
      grid: {
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
        containLabel: true,
      },
      yAxis: [
        {
          type: "category",
          inverse: true,
          axisLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
          axisLabel: {
            show: false,
          },
          data: lineYAxis,
        },
      ],
      xAxis: [
        {
          show: false,
        },
      ],
      series: pieSeries,
    };

    myChart.off("legendselectchanged");
    myChart.on("legendselectchanged", function (params) {
      var isSelected = params.selected[params.name];
      var title = params.name;
      if (isSelected == false) {
        myChart.dispatchAction({
          type: "legendToggleSelect",
          name: params.name,
        });
        myChart.dispatchAction({
          type: "highlight ",
          name: params.name,
        });
        clickFun && clickFun(params);
      }
    });

    myChart.setOption(myOption);
  }
    function setblBar(id,data){
        var myCharts = echarts.init($(id)[0]);
        var rightData=[]
        var leftData=[]
        rightData.push((data.right-0)+(data.left-0))
        leftData.push(data.left-0)
        var option=option = {
            xAxis: {
                   type: 'value',
                   data: ['received', 'accountsReceivable'],
                   show: false,
                 },
                 yAxis: {
                   type: 'category',
                   show: false,
                 },
                 grid: {
                   bottom: 0,
                   right: 0,
                   left: 0,
                   top:0
                 },
                 series: [
                   {
                     name: '已收',
                     type: 'bar',
                     stack: '总量',
                     data: leftData,
                     barWidth: 12,
                     itemStyle: {
                       color: '#2F9EFE',
                       barBorderRadius: [10, 0, 0, 10]
                     },
                     label: {
                       show: false,
                       formatter: '{name| {a} }{value| {c} }',
                       align: 'left',
                       position: [-4, -20],
                       rich: {
                         value: {
                           color: '#2F9EFE',
                           fontSize: 18,
                        //    fontWeight: 500,
                           lineHeight: 10,
                         },
                         name: {
                           color: '#fff',
                           fontSize: 16,
                        //    fontWeight: 400,
                           lineHeight: 10,
                         },
                       },
                     },
                   },
                   {
                     name: '应收',
                     type: 'bar',
                     stack: '总量',
                     data:rightData,
                     barWidth: 12,
                     itemStyle: {
                       color: '#FDAE5A',
                       barBorderRadius: [0, 10, 10, 0]
                     },
                     label: {
                        show:false,
                       formatter: '{name| {a} }{value| {c} }',
                       align: 'right',
                       position: [4, -20],
                       rich: {
                         value: {
                           color: '#FDAE5A',
                           fontSize: 18,
                           fontWeight: 500,
                           lineHeight: 30,
                         },
                         name: {
                           color: '#95A4B3',
                           fontSize: 14,
                           fontWeight: 400,
                           lineHeight: 30,
                         },
                       },
                     },
                   },
                 
                 ],
         };
        myCharts.setOption(option)
    }
  function PercentCircle(id,data,options,clickFun){
      console.log(data,'data')
    var elem = $(id)[0];
    var radius =options.radius||['90%', '100%']
    var fontSize=options.fontSize||15
    var unit=data.unit||''
    var title=(data.value-0)+unit;
    var colors=options.colors||{color1:'#FFBE4E',color2:'#FF9A37'}
    var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
    var myOption = {
        title: {
            text: title,
            x: 'center',
            y: 'center',
            textStyle: {
                fontWeight: 'normal',
                color: '#fff',
                fontSize:fontSize
            }
        },
        color: ['#282c40'],
        legend: {
            show: true,
            data: []
        },
        series: [{
            name: 'percent',
            type: 'pie',
            clockWise: true,
            radius: radius,
            center:['50%','50%'],
            data:data,
            itemStyle: {
                normal: {
                    label: {
                        show: false
                    },
                    labelLine: {
                        show: false
                    }
                }
            },
            hoverAnimation: false,
            data:[
                {
                    value:data.value-0,
                    name: 'finished',
                    itemStyle: {
                        color: { // 完成的圆环的颜色
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0, color:colors.color1||'#456FFB' // 0% 处的颜色
                            },{
                                offset: .5, color:colors.color2||'#456FFB' // 0% 处的颜色
                            }, {
                                offset: 1, color:colors.color2||'#456FFB' // 100% 处的颜色
                            }],
                            global: false
                        }           
                    }
                }, 
                {
                    name: 'unfinished',
                    value:100-data.value,
                    itemStyle:{
                        color:'rgba(42,69,136,1)'
                    }
                }
            ]
        }]
    };
    myChart.setOption(myOption, true)
    myChart.off("click");
    myChart.on("click",function(params){
        clickFun&& clickFun(data.key)
    });
    function formatData(){
        var data = [
            {
                value: 0,
                name: 'finished',
                itemStyle: {
                    color: { // 完成的圆环的颜色
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#2380FF' // 0% 处的颜色
                        },{
                            offset: .5, color: '#2380FF' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#2380FF' // 100% 处的颜色
                        }],
                        global: false
                    }           
                }
            }, 
            {
                name: 'unfinished',
                value: 0,
                itemStyle:{
                    color:'#EBEFFA'
                }
            }
        ],title='';
        let percent = 0,total = 0,value = 0;
        if(typeof data == 'number'){
            value = Number(data);
            if(Math.abs(data)<1 && Math.abs(data)>0){
                total = 1;
                percent = data==0?0:(data*100).toFixed(2);
            }else if(Math.abs(data)<100 && Math.abs(data)>1){
                total = 100;
                percent = data==0?0:(data).toFixed(2);
            }
        }else{
            value = data.value-0;
            total = data.total-0||100;
            percent = value==0?0:(value/total * 100).toFixed(2);
        }
        title = percent + '%'+"\n完成率";
        data[0].value = value;
        data[1].value = total - value;
        
        return {
            data: data,
            title: title
        };
    }
  }
    
    function setPie(id, data, option,clickFun) {
      
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.datas;
        var maxNameLength = ((datas.map(item => {
            return item.name.length;
        })).sort(function (a, b) {
            return b - a;
        }))[0];
        var total = 0;
        datas.map(item => {
            total += item.value;
        })
       var series=[{
        type: "pie",
        radius: option.radius||['35%', '65%'],
        center: option.center||['20%', '50%'],
        roseType:option.roseType||false,
        name: data.name || '',
        label: {
            show: false
        },
        labelLine: {
            show: false
        },
        data: datas,
        hoverOffset:5,
        minAngle: 5 ,
        animation: true ,
    },]
     if(!option.normalPie){
        series.push({
            type: "pie",
            radius: option.radius2|| ['35%', '38%'],
            center: option.center||['20%', '50%'],
            name: '',
            label: {
                show: false
            },
            labelLine: {
                show: false
            },
            data: [{
                value: 1,
                itemStyle: {
                    color: '#fff'
                }
            }],
            hoverAnimation:false
        })
     }
        var myOption = {
            color: option.color || ['#2F9EFE', '#34C39D', '#FDAE5A', '#FF6169', '#8E67FF', '#89D47F'],
            grid: {
                left: 0,
                right: 0,
                top: 0,
                bottom: 0,
                containLabel: true,
            },
            tooltip:{
                show:true,
                formatter: '{b}<br />数值：{c}<br />占比：{d}%',
                confine: true,
                // padding:0
            },
            legend: {
                // type:datas.length>8?'scroll':'',
                orient: "vertical",
                type: option.type||'',
                top: option.legendTop||'middle',
                left: option.legendLeft || "60%",
                itemWidth: $$.transVHFontSize(1.5),
                itemHeight: $$.transVHFontSize(1.1),
                itemGap: option.legendItemGap || $$.transVHFontSize(.6),
                padding: 0,
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff',
                    rich: {
                        name: {
                            fontSize: fontSize,
                            width:option.nameWidth|| maxNameLength * $$.fitFontSize(18)
                        },
                        value: {
                            fontSize: fontSize,
                            color: '#fff'
                        },
                        percent: {

                        }
                    }
                },
                // formatter:datas.length>8?'{name}':
                formatter: function (name) {
                    var showValue = option.showValue || false,
                        showPercent = option.showPercent || false;
                    var index = datas.map(item => item.name).indexOf(name);
                    if (name && index > -1) {
                        var value = datas[index].value,
                            percent = (value / total * 100).toFixed(option.fixedNum || 2);
                        return [
                            '{name|' + name + '}',
                            showValue ? '{value|' + (value + (data.unit || '')) + '}' : '',
                            showPercent ? '{percent|' + (percent + '%') + '}' : '',
                        ].join('')
                    } else {
                        return name
                    }
                },
                pageIconSize: $$.transVHFontSize(1),
                pageIconColor: '#2f4554' ,
                pageIconInactiveColor: '#fff' ,
                pageTextStyle:{
                    fontSize: fontSize,
                    color: '#fff',
                }
            },
            series:series
            // series: [{
            //         type: "pie",
            //         radius: option.radius||['35%', '65%'],
            //         center: option.center||['20%', '50%'],
            //         roseType:option.roseType||false,
            //         name: data.name || '',
            //         label: {
            //             show: false
            //         },
            //         labelLine: {
            //             show: false
            //         },
            //         data: datas,
            //         hoverOffset:5,
            //         minAngle: 5 ,
            //         animation: true ,
            //     },
            //     {
            //         type: "pie",
            //         radius: ['35%', '38%'],
            //         center: option.center||['20%', '50%'],
            //         name: '',
            //         label: {
            //             show: false
            //         },
            //         labelLine: {
            //             show: false
            //         },
            //         data: [{
            //             value: 1,
            //             itemStyle: {
            //                 color: '#fff'
            //             }
            //         }],
            //         hoverAnimation:false
            //     },
            // ]
        }
        myChart.setOption(myOption, true);
        // myChart.off('click');
        // myChart.on('click',function(params){
        //     console.log(params,"puuu")
        //     // clickFun&& clickFun(params)
        // });
        myChart.off("legendselectchanged");
        myChart.on("legendselectchanged",function(params){
            
            var isSelected = params.selected[params.name];
            var title=params.name
            if(isSelected == false){
                myChart.dispatchAction({
                    type:'legendToggleSelect',
                    name: params.name
                });
                myChart.dispatchAction({
                    type:'highlight ',
                    name: params.name
                });
                clickFun&& clickFun(params)
            }
        });
    }
    function setRadar(id, data,total){
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var indicator = data.map(item=>{
            return {
                name: item.name+'('+(item.value||0)+')',
                max: 100
            }
        })
        var myOption = {
            // backgroundColor:'#000',
            title: {
                text: total||0,
                left:'center',
                top:'middle',
                textStyle:{
                        color:'#fff',
                        fontSize: $$.fitFontSize(36),
                        fontWeight:'bold'
                    }
            },
            legend:{
                show:false
            },
            radar: {
                shape: 'circle',
                radius: '50% ',
                indicator: indicator,
                name:{
                    textStyle:{
                        color:'#fff',
                        fontSize: $$.fitFontSize(18)
                    }
                },
                splitLine:{
                    lineStyle:{
                        color:'#8793a2',
                        type:'dotted'
                    }
                },
                axisLine:{
                    lineStyle:{
                        color:'#8793a2',
                        type:'dotted'
                    }
                },
                splitArea:{
                    show:false
                }
            },
            series: [{
                animation: true ,
                name: 'value',
                type: 'radar',
                data: [
                    {
                        value: data.map(item=>item.value),
                        name: '值'
                    }
                ],
                itemStyle:{
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#1673FF' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#2FCAFD' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                },
                lineStyle:{
                    width:4,
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#1673FF' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#2FCAFD' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                },
                areaStyle:{
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#4FB2F8' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#1170C2' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                }
            }]
        };
        myChart.setOption(myOption, true)
    }
    function setLine(id, data, option,clickFun) {
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.series,
            series = [],
            unit = data.unit;
        var color = option.color || ['rgba(72,182,255,1)', '#8E67FF', '#2F9EFE'];
        var chartType = '';
        datas.map((item, i) => {
            chartType = item.type || 'line'
            series.push({
                animation: true,
                name: item.name,
                stack: item.stack || '',
                type: item.type || 'line',
                data: item.data,
                symbol: 'circle',
                // symbol: 'emptyCircle',
                symbolSize: 4,
                smooth: option.notSmooth ? false : true,
                barWidth: 10,
                lineStyle: {
                    width: 2,
                    color: color[i]
                },
                itemStyle: {
                    color: color[i]
                },
                areaStyle: {
                    show: option.hideArea ? false : true,
                    color: color[i],
                    opacity: option.hideArea ? 0 : .2
                },
                label: {
                    show: option.seriesLabel ? true : false,
                    position: 'top',
                    distance: 1,
                    textStyle: {
                        color: color[i],
                        fontSize: fontSize - 2
                    }
                }
            })
        })
        var myOption = {
            color: color,
            grid: {
                left: '2%',
                right: '6%',
                top: series.length == 1 ? $$.transVHFontSize(1.7 + 1.7) : $$.transVHFontSize(6),
                bottom: '0',
                containLabel: true,
            },
            legend: {
                show: series.length == 1 ? false : true,
                orient: "horizontal",
                top: 'top',
                left: "center",
                itemWidth: $$.transVHFontSize(1.2),
                itemHeight: $$.transVHFontSize(.8),
                itemGap: $$.transVHFontSize(2),
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff'
                }
            },
            tooltip: {
                show: true,
                trigger: "axis",
                // formatter:  (params)=> {// tooltip的formatter
                //     var relVal = params[0].name
                //     for (var i = 0, l = params.length; i < l; i++) {
                //       let settingUnit = this.option.setting[i].yAxisName;
                //       let unit = settingUnit || this.option.yAxis && this.option.yAxis[params[i].seriesIndex] && this.option.yAxis[params[i].seriesIndex].name || this.option.yAxisName;
                //         relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + (unit||'')
                //     }
                //     return relVal
                // }
            },
            xAxis: [{
                type: "category",
                show: true,
                interval: 0,
                boundaryGap: chartType == 'bar' ? true : false,
                axisLabel: {
                    show: true,
                    fontSize: fontSize,
                    color: "#fff",
                    interval: option.interval || 0,
                    rotate: option.xAxisRotate || 0,
                    formatter: option.xAxisOverflow ? function (params) {
                        return params.length > 3 ? params.substr(0, 2) + '...' : params;
                        return params.split('').join('\n')
                    } : '{value}'
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776"
                    },
                },
                axisTick: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776",
                    },
                },
                splitLine: {
                    show: option["yAxisSplitLineShow"] || false,
                    lineStyle: {
                        type: "dotted",
                        width: 0.5,
                        color: "#4F6776",
                    },
                },
                data: data.categories,
            },],
            yAxis: {
                show: true,
                type: "value",
                name: unit ? '单位：' + unit : "",
                nameGap: $$.transVHFontSize(1),
                nameTextStyle: {
                    //   align: "right",
                    fontSize: fontSize,
                    color: "#fff",
                },
                axisLabel: {
                    show: true,
                    fontSize: fontSize,
                    color: "#fff",
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776"
                    },
                },
                axisTick: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776",
                    },
                },
                splitLine: {
                    show: option["yAxisSplitLineShow"] || false,
                    lineStyle: {
                        type: "dotted",
                        width: 0.5,
                        color: "#4F6776",
                    },
                },
            },
            series: series
        }
        myChart.setOption(myOption, true)
        myChart.off("click");
        myChart.on("click", function (params) {
        clickFun && clickFun(params.data);
      
    });
    }
    function setBar(id, data, option,clickFun) {
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.series,
            series = [],
            unit = data.unit;
        var color = option.color || [
            {color2:'#ACCBFF',color1:'#2F9EFE'},
            {color2:'#ACCBFF',color1:'#2FFEAE'},
            {color2:'#ACCBFF',color1:'#FE9F2F'},
        ];
        var chartType = '';
        datas.map((item, i) => {
            chartType = item.type||'line'
            series.push({
                animation: true ,
                name: item.name,
                stack: item.stack || '',
                type: 'bar',
                data: item.data,
                barWidth:10,
                itemStyle: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: color[i].color1
                        },
                        {
                            offset: 1,
                            color: color[i].color2
                        }
                    ])
                },
                label:{
                    show:option.showLable||false,
                    position:'top',
                    distance:1,
                    textStyle:{
                        color: color[i],
                        fontSize: $$.fitFontSize(16)
                    }
                }
            })
        })
        var myOption = {
            color: color,
            grid: {
                left:  '1%',
                right: 0,
                top: unit ? $$.transVHFontSize(1.5 + 1.7) : 0,
                bottom: '0',
                containLabel: true,
            },
            legend: {
                show: series.length==1?false:true,
                orient: "horizontal",
                top: 'top',
                left: "right",
                itemWidth: $$.transVHFontSize(1.2),
                itemHeight: $$.transVHFontSize(.8),
                itemGap: $$.transVHFontSize(2),
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff'
                }
            },
            tooltip: {
                show: true,
                trigger: "axis",
                // formatter:  (params)=> {// tooltip的formatter
                //     var relVal = params[0].name
                //     for (var i = 0, l = params.length; i < l; i++) {
                //       let settingUnit = this.option.setting[i].yAxisName;
                //       let unit = settingUnit || this.option.yAxis && this.option.yAxis[params[i].seriesIndex] && this.option.yAxis[params[i].seriesIndex].name || this.option.yAxisName;
                //         relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + (unit||'')
                //     }
                //     return relVal
                // }
            },
            xAxis: [{
                type: "category",
                show: true,
                interval: 0,
                boundaryGap:true,
                axisLabel: {
                    show: true,
                    fontSize: fontSize,
                    color: "#fff",
                    interval: option.interval||0,
                    rotate: option.xAxisRotate||0,
                    formatter: option.xAxisOverflow?function(params){
                        return params.length>3?params.substr(0,2)+'...':params;
                        return params.split('').join('\n')
                    }:'{value}'
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776"
                    },
                },
                axisTick: {
                    show:  true,
                    lineStyle: {
                        color: "#4F6776",
                    },
                },
                splitLine: {
                    show: option["yAxisSplitLineShow"] || false,
                    lineStyle: {
                        type: "dotted",
                        width: 0.5,
                        color: "#4F6776",
                    },
                },
                data: data.categories,
            }, ],
            yAxis: [
                {
                    show: true,
                    type: "value",
                    name: unit ? '单位：' + unit : "",
                    nameGap: $$.transVHFontSize(1.5),
                    nameTextStyle: {
                        //   align: "right",
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLabel: {
                        show: true,
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show: option["yAxisSplitLineShow"] || false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
            ],
            series: series
        }
        myChart.setOption(myOption, true)
        myChart.off('click').on("click",function(params){
            clickFun&&clickFun(params)
        })
    }
    function setZBData(id,originalData,callback){
        var data = originalData||{};
        $.each(originalData,function(k,val){
            if($(id+' [data-key="'+k+'"]') && $(id+' [data-key="'+k+'"]').length>0){
                $(id+' [data-key="'+k+'"]').html(val||0);
                $(id+' .num[data-key="'+k+'"]').rollNum({
                    deVal: val - 0,
                    transToThursand: true
                    // className:'my_scroll_num'
                });
            }
        })
        // $(id+' [data-key]').each(function(i,ele){
        //     var key = $(this).attr('data-key');
        //     $(ele).html(data[key]||0)
        // })
       
        callback && callback(data);
    }
    function setMapTypeSelects(){// 动态生成地图指标
        var type = "main";
        var selectDatas = mapTypes[type],html='';
        $.each(selectDatas,function(i,item){
            html += `<div class="tab_content_item ${item.value}" >
                        <input type="radio" name="mapType" checked group="mapType" value="${item.value}" />
                        <i class="radio"></i>
                       
                        <span class="map_type_name">${item.name}</span>
                    </div>`
        });
        $('.chose_box').html(html);
        $('.tab_content_item [name="mapType"]').change(function(){//TODO: 切换地图类型
            // return;
            var type = $('.tablist .tab_item.active').attr('data-maptype');
            var dType = this.value;
            console.log('type',type);
            getMapNum(dType);
            initMap(type=='lhyg'?'330000':'');

            // setMapLevel();
          
        });
        $('.tab_content_item').eq(0).find('[name="mapType"]').attr("checked",true);
        // setMapLevel();
      

    }
    function setMapLevel(){
        var type = "main";
        var subType = $('.tab_content_item [name="mapType"]:checked').val();
        if(subType == 'cyrrs' || type =='ldmjzz' || type =='dxsjjq'){
            $('.levels_con').hide();
            return;
        }else{
            $('.levels_con').show();
        }
        var selectDatas = mapLevelSelects[type+'_zbajs'],html='';
        if(selectDatas && selectDatas.length>0){
            $.each(selectDatas,function(i,item){
                html += `<div class="item">
                            <i class="rect ${ item.class }"></i>
                            <span>${ getLevelText(item) }</span>
                        </div>`
            });
            $('.levels_con').html(html);
        }else{
            $('.levels_con').hide();
        }
        
        function getLevelText(item){
            if(item.lt && item.gt){
                return item.gt+'~'+item.lt+''
            }else if(item.lt && !item.gt){
                return item.lt + '以下'
            }else if(!item.lt && item.gt){
                return item.gt + '以上'
            }
        }
        
    }
    function initMap(callback) {//初始化地图
        myGDMap && myGDMap.clearMap();
        $.get('../json/' + $$.handleQXCode(mapAreaCode)+ '.json',function (res) {
            plynDatas = res.map(aoi => {
                var regEx = /\s+/g;
                var wkt = aoi.wkt.replace(regEx, ' ').split(',')
                aoi.wkt = wkt.map(pair => pair.split(' '))
                return aoi;
            });
            setMapPlyn(plynDatas);
            getPoints();
            callback && callback();
        })
    }
    function getPoints() {//获取地图点数据
        myGDMap.off('click')
        // var type = $('.tablist .tab_item.active').attr('data-maptype');
        var type="main"
        var subType = $('.tab_content_item [name="mapType"]:checked').val();
        var subTypeName = $('.tab_content_item [name="mapType"]:checked').siblings('.map_type_name').html();
        var dType;
        subType == 'zbajs' ? dType = 1 : (subType == 'zcaqjal' ? dType = 2 : (subType == 'wlbal' ? dType = 3 : dType = 4))
        var params = {
            method: 'arbitrationReviewSecondaryFive',
            year: commonYear,
            source:3,
            administrativeDivisionCode: mapAreaCode,
            dType: dType
            // aab301: mapAreaCode,
        }
        var mapUrl ={
            // zbajs:"/zjax/admin/Djg/zfjgMapZbaj",
            // ssjsjccs:"/zjax/admin/Djg/zfjgMapZSsj"
            zbajs: "/lemis/business/dp/tsInterface",
            zcaqjal: "/lemis/business/dp/tsInterface",
            wlbal: "/lemis/business/dp/tsInterface",
            tjcgl: "/lemis/business/dp/tsInterface"
        };
        $$.ajaxRequest(ajaxUrl2 + mapUrl[subType],params,function (res) {
            setPoints(res.data,type,subType,subTypeName);
        });
        // res = {"data":[
        //     {"aab301":"330100","ctname":"杭州市","lng":"119.553580","lat":"30.025000","value":88.37},
        //     {"aab301":"330200","ctname":"宁波市","lng":"121.509789","lat":"29.868387","value":62.77},
        //     {"aab301":"330300","ctname":"温州市","lng":"120.602112","lat":"27.900574","value":89.19},
        //     {"aab301":"330400","ctname":"嘉兴市","lng":"120.750862","lat":"30.762653","value":80.52},
        //     {"aab301":"330500","ctname":"湖州市","lng":"119.952420","lat":"30.879381","value":93.52},
        //     {"aab301":"330600","ctname":"绍兴市","lng":"120.582115","lat":"29.907116","value":80.75},
        //     {"aab301":"330700","ctname":"金华市","lng":"119.989506","lat":"29.129523","value":90.12},
        //     {"aab301":"330800","ctname":"衢州市","lng":"118.722627","lat":"28.991708","value":79.68},
        //     {"aab301":"330900","ctname":"舟山市","lng":"122.106865","lat":"30.016027","value":92.08},
        //     {"aab301":"331000","ctname":"台州市","lng":"121.108596","lat":"28.901379","value":88.59},
        //     {"aab301":"331100","ctname":"丽水市","lng":"119.321783","lat":"28.151994","value":87.76},
        //     {"aab301":"330000","ctname":"浙江省","lng":"120.153580","lat":"30.287458","value":84}
        // ],"state":"ok"};
        // setPoints(res.data,type,subType,subTypeName);
    }
  
    function setPoints(datas,type,subType,subTypeName,tableUrl) {//添加地图点
        // datas = datas.filter(item => item.administrativeDivisionCode != mapAreaCode)
        datas=datas
        $.each(datas, function (i, item) {
            var html = `<div class="map_text_con ${subType} ${(subType+'_'+item.administrativeDivisionCode)} ${getPointClass(item.value,type,subType)}">
            <div class="effect_scatter">
                <div class="effect_circle circle"></div>
                <div class="effect_circle effect_circle1"></div>
                <div class="effect_circle effect_circle2"></div>
                <div class="effect_circle effect_circle3"></div>
            </div>
            <div class="area_box">
                <div class="text">${item.name}</div>
            </div>
            <div class="num_box num white">${item.value}</div>
            <div class="name_box">${subTypeName}</div>
        </div>`
                            // <span class="map_unit">万人</span>
            // let html = '<div class="mapIcon mapIcon">' + item.value + '<span class="dw">' + item.ctname + '</span></div>';

            marker = new AMap.Marker({
                // position: new AMap.LngLat(item.lng-0, item.lat-0),
                // content: item.ctname,
                position: new AMap.LngLat(item.lng - 0, item.lat - 0),
                // 将 html 传给 content
                content: html,
                // 以 icon 的 [center bottom] 为原点
                offset: new AMap.Pixel(-18, -15),
                data: item
            });
            myGDMap.add(marker);
            AMap.event.addListener(marker, 'click', function (e) { //添加点击事件,传入对象名，事件名，回调函数
                if(subType=="zbajs"){
                 alertZBAYZBtable(subTypeName,{zbaj:1,administrativeDivisionCode:e.target.w.data.administrativedivisioncode})
                }
             })
          
        })
    }
  
    function getPointClass(value,type,subType){// 转换点样式
        var levelTypeClass = '';
        var levels = mapLevelSelects["main_zbajs"];
        if(levels && levels.length>0){
            $.each(levels,function(i,item){
                if(item.lt && item.gt && (value<item.lt && value>=item.gt)){
                    levelTypeClass = 'map_text_con_'+item.class;
                }else if(item.lt && !item.gt && value<item.lt){
                    levelTypeClass = 'map_text_con_'+item.class;
                }else if(!item.lt && item.gt && value>=item.gt){
                    levelTypeClass =  'map_text_con_'+item.class;
                }
            });
        }
       
        return levelTypeClass;
    }
    function setMapPlyn(datas) {// 生成地图区块
        mapPlyns = [];
        $.each(datas, function (i, item) {
            // var index = plynDatas.map(item=>item.aoiid).indexOf(item.aab301);
            // if(index > -1){
            plynItem = item;
            plynItem.areaCode = item.aoiid;
            plyn = new AMap.Polygon({
                bubble: true,
                fillOpacity: 0.8,
                fillColor: mapColor.normal,//填充颜色
                strokeColor:'#8BB3E3',//轮廓线
                strokeWeight: .1,
                path: plynItem.wkt,
                map: myGDMap,
                data: plynItem,
                cont: [plynItem.x, plynItem.y]
            })
            // }
            mapPlyns.push(plyn);
            AMap.event.addListener(plyn, 'click', function (e) { //添加点击事件,传入对象名，事件名，回调函数
                areaClick(e.target.w.data, e.target.w.cont, e)
                setModelMain(true)
            })
        });
        myGDMap.off('zoomchange').on('zoomchange', function (e,b,c) {
            //TODO: 监听地图缩放
            if(isMapClick){// 下钻，切换区县
                isMapClick = false;
                return;
            }else{
                var zoom = myGDMap.getZoom();
                if(mapLastZoom != zoom){//避免重复触发
                    mapLastZoom = zoom;
                    var mouseMapArea = '';
                    if(mouseLnglat){// 判断鼠标当前在那个地区
                        $.each(mapPlyns,function(i,plynItem){
                            if(plynItem.contains(mouseLnglat)){
                                mouseMapArea = plynItem.w.data;
                                plynItem.setOptions({
                                    fillColor: mapColor.active
                                })
                            }else{
                                plynItem.setOptions({
                                    fillColor: mapColor.normal
                                })
                            }
                        })
                    }
                    var mapLevel = getAreaLevel(mouseMapArea.aoiid);
                    console.log(zoom,"zoom")
                    if (zoom == 7) {
                        mapAreaCode = '330000';
                        myGDMap.setCenter( [120.153576,29.289523])
                        $('.map_tit .loc').eq(0).nextAll().remove();
                        setModelMain()
                        // changeModel();
                    } else if (zoom == 9) {
                        var areacode,center;
                        if (mapLevel == 2){//当前为区县，缩小
                            areacode = $('.map_tit .loc').eq(1).attr('data-i');
                            center = ($('.map_tit .loc').eq(1).attr('data-lnglat')).split(',');
                            $('.map_tit .loc').eq(1).nextAll().remove();
                            mapAreaCode = areacode;
                            myGDMap.setCenter(center);
                            setModelMain(true)
                            // changeModel(true);
                        }else{//放大
                            if(mouseMapArea && mapAreaCode != mouseMapArea.aoiid){
                                areacode = mouseMapArea.aoiid;
                               
                                center = [mouseMapArea.x,mouseMapArea.y];
                                 $('.map_tit').append('<span  data-i="'+areacode+'" data-lnglat="'+(center.join(','))+'"   class="loc" >  '+mouseMapArea.name+'</span>')
                                mapAreaCode = areacode;
                                myGDMap.setCenter(center);
                                setModelMain()
                                // changeModel();
                            }
                        }
                    }else if (zoom == 11){
                        areacode = mouseMapArea.aoiid;
                        center = [mouseMapArea.x,mouseMapArea.y];
                        mapAreaCode = areacode;
                        // if($('.map_tit .loc').length>=3 ){//区县，不增加
                        //     $('.map_tit .loc').eq(2).attr('data-i',areacode);
                        //     $('.map_tit .loc').eq(2).attr('data-lnglat',center.join(','));
                        //     $('.map_tit .loc').eq(2).html(' '+mouseMapArea.name);
                        // }else{
                        //     $('.map_tit').append('<span  data-i="'+areacode+'" data-lnglat="'+(center.join(','))+'"   class="loc">  '+mouseMapArea.name+'</span>')
                        // }
                        myGDMap.setCenter(center);
                        // setModelMain(true)
                    }
                }
            }
        });
    }
    
    function areaClick(data, cont, ev) {
        //TODO: 地区点击事件
        isMapClick = true;
        $.each(mapPlyns,function(i,plyn){
            plyn.setOptions({
                fillColor: mapColor.normal
            })
        })
        mapActiveAreaData = data;
        var mapLevel = getAreaLevel(data.areaCode);
        var zoom = myGDMap.getZoom();
        ev.target.setOptions({
            fillColor: mapColor.active
        });
        var option = ev.target.getOptions();
        var type = $('.tablist .tab_item.active').attr('data-maptype');
        if(type == 'lhyg'){
            if (zoom >= 8 && zoom <= 20) {
                if (mapLevel == 1) {//市级
                    mapAreaCode = data.areaCode;
                    myGDMap.setZoomAndCenter(9, [data.x, data.y]);
                    if($('.map_tit .loc').length>=2 ){//区县，不增加
                        $('.map_tit .loc').eq(1).attr('data-i',mapAreaCode);
                        $('.map_tit .loc').eq(1).attr('data-lnglat',[data.x, data.y].join(','));
                        $('.map_tit .loc').eq(1).html(' '+data.name);
                    }else{
                        $('.map_tit').append('<span  data-i="'+mapAreaCode+'" data-lnglat="'+([data.x, data.y].join(','))+'"   class="loc">  '+data.name+'</span>')
                    }
                    setModelMain(true);
                } 
            }
        }else{
            if (zoom >= 8 && zoom <= 20) {
                if (mapLevel == 1) {//市级
                    mapAreaCode = data.areaCode;
                    myGDMap.setZoomAndCenter(9, [data.x, data.y])
                    $('.map_tit').append('<span  data-i="'+mapAreaCode+'" data-lnglat="'+([data.x, data.y].join(','))+'"  class="loc">  '+data.name+'</span>')
                    setModelMain();
                } else if (mapLevel == 2) {//区县
                    if(mapAreaCode == data.areaCode){
                        if(isMapScale ){// 第二次点击，放大
                            isMapScale = false;
                            myGDMap.setZoomAndCenter(11, [data.x, data.y]);
                        }else{// 第二次点击，缩小
                            isMapScale = true;
                            myGDMap.setZoomAndCenter(9, [data.x, data.y]);
                            ev.target.setOptions({
                                fillColor: mapColor.normal
                            });
                            // $('.map_tit .loc').eq(1).nextAll().remove();
                        }
                    }else{//首次点击，切换数据
                        mapAreaCode = data.areaCode;
                        isMapScale = true;
                        if($('.map_tit .loc').length>=3 ){//区县，不增加
                            $('.map_tit .loc').eq(2).attr('data-i',mapAreaCode);
                            $('.map_tit .loc').eq(2).attr('data-lnglat',[data.x, data.y].join(','));
                            $('.map_tit .loc').eq(2).html(' '+data.name);
                        }else{
                            $('.map_tit').append('<span  data-i="'+mapAreaCode+'" data-lnglat="'+([data.x, data.y].join(','))+'"   class="loc">  '+data.name+'</span>')
                        }
                        mapAreaCode = data.areaCode;
                        myGDMap.setZoomAndCenter(9, [data.x, data.y])
                        setModelMain(true);;
                    }
                }
            }
        }
        
    }
    
    function iconClick(data,type) {//地区点击事件
      
    }

    function getAreaLevel(areaCode) {//获取地图层级
        areaCode += "";
        if (areaCode.length > 6) {
            return 3;
        } else if (areaCode.length == 6) {
            if (areaCode.substr(2) == "0000") {
                return 0;
            } else if (areaCode.substr(4) == "00") {
                return 1;
            } else {
                return 2;
            }
        }
    }
  
    // 最新案件更多列表
    function alertZXAJtable(title,params,abb017Start,abb017End,abz345,cxfw){
        params= params||{}
         if(!params.administrativeDivisionCode){
           params.administrativeDivisionCode=mapAreaCode
         }
         if(!params.year){
           params.year=commonYear
         }
       var where={
           mType: 1,
             abz345: abz345 || '',
             cxfw: cxfw || '',
             abb017Start:abb017Start || '',
             abb017End:abb017End || ''
           }
       $$.alertTable({
           title: title,
           colsData: [
             [
               { title: "序号", type: "numbers" },
               { title: "案号", field: "abb016" },
               { title: "申请人", field: "abb703" },
               { title: "被申请人", field: "abb704" },
               { title: "仲裁员(申请接待员)", field: "pop1_1"},
             ],
           ],
           url: ajaxUrl2 + "/lemis/business/dp/tsInterface?method=caseList&source=3&zxbj=1&mType=3",
           where: Object.assign(params,where),
           pageProp: {
             limit: 10,
           },
           searchColumn: [
             {
               name: "所属仲裁机构",
               field: "abz345",
               type:'dropdown',
               dicData: zcyjgList,
             },
             {
               name: "查询范围",
               field: "cxfw",
               type: "select",
               dicData: cxfwList,
             },
             { name: "立案时间起", field: "abb017Start", type: "datePicker", range: false, subtype: "date", format: "yyyy年MM月dd日" },
             { name: "立案时间至", field: "abb017End", type: "datePicker", range: false, subtype: "date", format: "yyyy年MM月dd日" },
           ],
           rowClickFun: function (obj) {
               let data = obj.data.abz301;
               alertZBAJDetails(data);
            
           },
         });
    }
  
 
   
})